import React from 'react';
import { View, Text, Button,SafeAreaView } from 'react-native';
import {useDispatch, useSelector } from 'react-redux';
import rootReducer from './src/redux/reducers';
import { decrement, increment } from './src/redux/reducers/counterReducer';
 
function Test(): JSX.Element {
  const count = useSelector((state: ReturnType<typeof rootReducer>) => state.counter.count);
  const dispatch = useDispatch();
  // debugger;
  console.log('111111')
 
  const handleIncrement = () => {
    dispatch(increment());
  };
 
  const handleDecrement = () => {
    dispatch(decrement(1));
  };
  return (
    <SafeAreaView>
      <View><Text>2233</Text></View>
    <View>
      <Text>Count: {count}</Text>
      <Button title="加" onPress={handleIncrement} />
      <Button title="减" onPress={handleDecrement} />

    </View>
    </SafeAreaView>
  );
}
 
export default Test;
